package TestCases;

import java.util.HashMap;
import java.util.Map;
import com.crc.mam.BaseCase;
import coms.AutoException;
import coms.Constants;
import coms.process.EmployeeLoanClaimProcess;
import coms.process.LoginTest;
import frame.FrameWork;
import frame.InterTest;

/**
 * 员工借款
 * @author CHENHAILIAN6
 *
 */
public class EmploeeLoanAuditTestcase extends BaseCase implements InterTest  {
  String categoryCode ;

  public String getCategoryCode() {
    return categoryCode;
  }

  public void setCategoryCode(String categoryCode) {
    this.categoryCode = categoryCode;
  }

  public static void main(String[] args) {
    // TODO Auto-generated method stub
    EmploeeLoanAuditTestcase audit = new EmploeeLoanAuditTestcase();
    HashMap<Object, Object> inputParam = new HashMap<Object, Object>();
    String url = "http://10.0.49.58";
    inputParam.put("url", url);
    audit.run(inputParam);
    
  }


  @Override
  public void run(Map<Object, Object> paramMap) {
    // TODO Auto-generated method stub
    String url = (String) paramMap.get("url");
    if(url == null) {
      url = Constants.BASE_URL;
    }
    FrameWork.setBaseUrl(url);
    LoginTest loginTest = new LoginTest();
    loginTest.run(paramMap);
    if(!loginTest.status) {
      remark = loginTest.remark;
      status = false;
      throw new AutoException("登录失败，阻碍测试");
    }
    EmployeeLoanClaimProcess process = new EmployeeLoanClaimProcess();
    process.run(paramMap);    
    if(!process.status) {
      remark = process.remark;
      status = false;
      throw new AutoException("报账单申请失败，阻碍测试");
    }
    HashMap<Object ,Object> inputParam = new HashMap<Object ,Object>();
    inputParam.put("claimId", process.getClaimId());
    inputParam.put("claimNo", process.getClaimNo());
    inputParam.put("amount", process.getAmount());
    AuditProcessTestcase audit = new AuditProcessTestcase();
    audit.run(inputParam);
    if(!audit.status) {
      remark = audit.remark;
      status = false;
    }else {
      status = true;
    }
   
  }

  @Override
  public boolean getStatus() {
    // TODO Auto-generated method stub
    return false;
  }

  @Override
  public String getRemark() {
    // TODO Auto-generated method stub
    return null;
  }

}
